home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Gekikoh Dennoh Club 1
/
Gekikoh Dennoh Club Vol. 1 (Japan).7z
/
Gekikoh Dennoh Club Vol. 1 (Japan) (Track 1).bin
/
kowin
/
archive
/
sys
/
kowin14d.lzh
/
smpl
/
mtmlib
/
more.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-02-11
|
1KB
|
74 lines
/* MiniTERM v2 smpl */
#include <mtm_stdio.h>
#define MTA_WINDOW_TITLE "more"
#define MTA_WINDOW_SIZEX 80
#define MTA_WINDOW_SIZEY 25
#include "mtm_conf.c"
FILE *Fp= NULL;
static
file_close()
{
if( Fp ){
fclose( Fp );
Fp= NULL;
}
}
static int
key( msg )
char *msg;
{
for(;;){
int c;
fputs( msg, stdout );
c= getch();
fputs( " \r", stdout );
switch( c ){
case ' ': return 24;
case '\r': return 1;
case 'Q':
case 'q': return -1;
}
}
}
more( file )
char *file;
{
int line= 0,
next= 24;
if( Fp= fopen( file, "rb" ) ){
int c;
for(; (c= fgetc( Fp )) >= 0 ;){
putchar( c );
if( c == '\n' ){
if( ++line == next ){
line= 0;
next= key( "=more=\r" );
}
}
}
fclose( Fp );
Fp= NULL;
for(; key( "=eof=\r" ) != -1 ;);
}
}
main( argc, argv )
char **argv;
{
signal( kSIGTERM, file_close );
for(; --argc ;)
more( *++argv );
}
/*
ファイルの more 表示をするだけ
*/